package org.project.task.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.bind.ServletRequestUtils;

public class BaseController {
    @Resource
    private HttpServletRequest request;
    // protected是为了让基础的子类可以使用该父类中的方法
    protected Page getPage(){
        int current = ServletRequestUtils.getIntParameter(request, "current", 1);
        int size = ServletRequestUtils.getIntParameter(request, "size", 10);
        return new Page(current, size);
    }
}